<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/11
  Time: 0:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>支付结果</title>
    <script src="<%= request.getAttribute("StaticHost") %>/js/jquery.js"></script>
</head>
<body>

</body>
<%
    String msg = (String) request.getAttribute("msg");
    String type = (String) request.getAttribute("type");
    String merchantOrderNo = (String) request.getAttribute("merchantOrderNo");
%>
    <div style="text-align: center;line-height: 80px;">
    <h3 id="msg"><%=msg%></h3>
    </div>
    <script>
        var timer;
        $(function(){
            var type = "<%=type%>";
            if(type=="payResult"){
                timer = setInterval('findOrder()',3000);
            }
        });
        function findOrder() {
            $.ajax({
                url: "${pageContext.request.contextPath}/ajax?n=findorderstatus&orderNo=" + "<%=merchantOrderNo%>",
                type: "GET",
                async: true,//true异步 false同步
                context: this,
                timeout: 10000,
                success: function (data) {
                    //alert("data:"+data);
                    if (data != null && data == "1") {
                        $('#msg').html("支付成功");
                        clearInterval(timer);
                    }
                },
                error: function (d, s, b) {
                    alert("失败:" + b);
                }
            });
        }

    </script>
</html>
